﻿using System;
using System.Windows.Data;
using System.Windows.Media;
using Microsoft.TeamFoundation.WorkItemTracking.Client;

namespace WIAssistant
{
    [ValueConversion(typeof(double), typeof(String))]
    public class WorkItemTypeToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter,System.Globalization.CultureInfo culture)
        {
            WorkItemType type = (WorkItemType) value;

            switch (type.Name)
            {
                case "Bug":
                    return new SolidColorBrush(Color.FromRgb(212,255,170));
                case "Sprint Backlog Item":
                    return Brushes.LightBlue;
                case "Product Backlog Item":
                    return Brushes.LightCyan;
                case "Sprint":
                    return Brushes.LightGoldenrodYellow;
                case "Retrospective":
                    return Brushes.LightBlue;
                case "Impediment":
                    return Brushes.LightGreen;
                default:
                    return Brushes.WhiteSmoke;
            }
            
            
        }
        public object ConvertBack(object value, Type targetType,object parameter,System.Globalization.CultureInfo culture)
        {
            throw new Exception("The method or operation is not implemented.");
        }

    }
}
